www.gusucode.com > 星梦奇缘交友网 1 > 星梦奇缘交友网 1.0源码程序/love/visual_send.asp
<!--#include file=conn.asp--> <!--#include file=config.asp--> <!--#include file=const.asp--> <!--#include file=char.asp--> <!--#include file="Visual_const.asp" --> <% '========================================================= ' File: visual_send.asp ' Version:3.0 ' Date: 2005-10-29 ' Script Written by xmrxw '========================================================= ' Copyright (C) 2004,2005 920520.com All rights reserved. ' Web: http://www.920520.com,http://www.xmzxw.com ' Email: info@mssky.com,super@mssky.com ' QQ:10689579 Msn:zdlmicr@hotmail.com '========================================================= dim CurItem,ItemName,rsvisual,UserName,MsgBody dim SucFlag,CartBag,SendMsg dim SendSplit,CurType dim itemsplit,itemcount dim sendfee,CurDate,CurPrice,SalePrice SucFlag=False if request("myself")=1 then itemcount=0 else if request("fromuser")<>"" then itemcount=0 else CartBag=request.cookies("mybuy_"&userid) if isnull(CartBag) then CartBag="" if CartBag="" then itemcount=0 else itemsplit=split(CartBag,"|") itemcount=ubound(itemsplit)+1 end if end if end if founderr=false if not founduser or membername="" then SendMsg=SendMsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>,不能使用个人形象设计功能。如果您还没有<a href=reg.asp>注册</a>,请先<a href=reg.asp>注册</a>!" founderr=true end if if isnull(request("itemid")) or request("itemid")="" then SendMsg=SendMsg+"<br>"+"<li>没有指定商品编号!" founderr=true else CurItem=CheckStr(request("itemid")) if not isnumeric(curitem) then SendMsg=SendMsg+"<br>"+"<li>提交的数据有错误!" founderr=true end if end if if request("action")="send" then if isnull(Request("username")) or Request("username")="" then SendMsg=SendMsg+"<br>"+"<li>受赠者不可为空!" founderr=true else UserName=CheckStr(Request("username")) if lcase(trim(username))=lcase(trim(membername)) then SendMsg=SendMsg+"<br>"+"<li>不能给自己赠送商品!" founderr=true end if if conn.execute("select top 1 userid from [Ms_user] where username='"&username&"'").eof then SendMsg=SendMsg+"<br>"+"<li>受赠者不存在!" founderr=true end if end if if isnull(Request("msgbody")) or Request("msgbody")="" then SendMsg=SendMsg+"<br>"+"<li>随同赠言不可为空!" founderr=true else msgbody=CheckStr(Request("msgbody")) end if elseif itemcount>0 then if isnull(Request("username")) or Request("username")="" then UserName="" else UserName=CheckStr(Request("username")) end if MsgBody="" for i=0 to itemcount-1 SendSplit=split(itemsplit(i),"$") if ubound(SendSplit)=2 then if SendSplit(0)=CurItem and lcase(trim(SendSplit(1)))=lcase(trim(UserName)) then MsgBody=SendSplit(2) SucFlag=true exit for end if end if next end if call nav() if founderr then call head_var("虚拟形象","Visual.asp") call Send_Msg() else set rsvisual=server.createobject("ADODB.Recordset") if request("action")="send" then sql="select top 1 itemid from visual_myitems where username='"&username&"' and itemid="&CurItem rsvisual.open sql,conn,1,1 if not (rsvisual.eof or rsvisual.bof) then SendMsg=SendMsg+"<br>"+"<li>用户 <font color=blue>"&username&"</font> 已经拥有该商品,无须赠送!" founderr=true end if rsvisual.close end if sql="select * from visual_items where id="&CurItem rsvisual.open sql,conn,1,1 ItemName=rsvisual("name") CurType=rsvisual("type") mod 100 if CurType>=5 then CurType=4 sendfee=int(rsvisual("price1")*conn.execute("select top 1 send from visual_config")(0)/100+0.99) if v_myvip<=1 then CurPrice=rsvisual("price1") else CurPrice=rsvisual("price2") end if if request("myself")=1 then set rs=server.createobject("adodb.recordset") sql="select * from visual_myitems where itemid="&CurItem&" and username='"&membername&"'" rs.open sql,conn,1,1 if rs.eof then SendMsg=SendMsg+"<br>"+"<li>您没有这个商品,不能赠送!" founderr=true end if rs.close set rs=nothing else if request("fromuser")<>"" then set rs=server.createobject("adodb.recordset") sql="select saleprice from visual_myitems where itemid="&CurItem&" and username='"&checkstr(trim(request("fromuser")))&"'" rs.open sql,conn,1,1 saleprice=rs("salePrice") if saleprice+sendfee>mymoney then sendmsg=sendmsg+"<br>"+"<li>购买并赠送此商品需要现金 "&(saleprice+sendfee)&" 元,您的现金("&mymoney&" 元)不足,无法赠送!" founderr=true end if rs.close set rs=nothing else if rsvisual("vip") and v_myvip<=1 then SendMsg=SendMsg+"<br>"+"<li>您不是VIP,不能购买VIP专用商品!" founderr=true end if if rsvisual("quantity")<=0 then SendMsg=SendMsg+"<br>"+"<li>该商品库存不足,您无法购买!" founderr=true end if if rsvisual("flag")=0 then SendMsg=SendMsg+"<br>"+"<li>保留商品,您无法购买!" founderr=true end if if rsvisual("flag")=1 and membername="" then SendMsg=SendMsg+"<br>"+"<li>只有会员才能购买此商品,您无法购买!" founderr=true end if if rsvisual("flag")=2 and not master and not Standmaster and not supermaster then SendMsg=SendMsg+"<br>"+"<li>只有版主以上人员才能购买此商品,您无法购买!" founderr=true end if if rsvisual("flag")=3 and not master and not supermaster then SendMsg=SendMsg+"<br>"+"<li>只有超级版主和管理员才能购买此商品,您无法购买!" founderr=true end if if rsvisual("flag")=4 and not master then SendMsg=SendMsg+"<br>"+"<li>只有管理员才能购买此商品,您无法购买!" founderr=true end if end if end if rsvisual.close set rsvisual=nothing if founderr then call Send_Msg() else if request("action")="send" then if request("myself")=1 then CurDate=year(now())&"-"&month(now())&"-"&day(now()) conn.execute("update visual_myitems set username='"&username&"',FromUser='"&membername&"',Type="&CurType&" where username='"&membername&"' and itemid="&curItem) conn.execute("insert into visual_events (ItemID,UserName,FromUser,DateAndTime,Price,Type) values ("&CurItem&",'"&UserName&"','"&membername&"','"&curdate&"',"&curprice&",1)") set rs=server.createobject("adodb.recordset") sql="select * from [Ms_message]" rs.open sql,conn,1,3 rs.addnew rs("sender")=membername rs("incept")=UserName rs("title")="送您一件礼物,《"&ItemName&"》!" rs("content")=MsgBody&chr(10)&chr(10)&"商品已经放到您的储物柜中,请笑纳!"&chr(10)&"请到以下地址查看储物柜。"&chr(10)&"[URL=Visual.asp?shopid=100]查看储物柜[/URL]" rs("flag")=0 rs("issend")=1 rs.update rs.close set rs=nothing conn.execute("update [Ms_user] set userwealth=userwealth-"&SendFee&" where username='"&membername&"'") SendMsg="<li>已经成功地给 <font color=blue>"&username&"</font> 赠送了《<font color=blue>"&itemName&"</font>》!" response.write "<script>" response.write "window.opener.document.execCommand('Refresh');" response.write "</script>" call Send_Msg() else if request("fromuser")<>"" then CurDate=year(now())&"-"&month(now())&"-"&day(now()) conn.execute("update visual_myitems set username='"&username&"',FromUser='"&membername&"',Type="&CurType&",price=saleprice,saleprice=0 where username='"&checkstr(trim(request("fromuser")))&"' and type=5 and itemid="&curItem) conn.execute("update visual_events set username='"&membername&"' where itemid="&curitem&" and type=2 and fromuser='"&checkstr(trim(request("fromuser")))&"' and (username='' or isnull(username))") conn.execute("insert into visual_events (ItemID,UserName,FromUser,DateAndTime,Price,Type) values ("&CurItem&",'"&UserName&"','"&membername&"','"&curdate&"',"&saleprice&",1)") set rs=server.createobject("adodb.recordset") sql="select * from [Ms_message]" rs.open sql,conn,1,3 rs.addnew rs("sender")=membername rs("incept")=UserName rs("title")="送您一件礼物,《"&ItemName&"》!" rs("content")=MsgBody&chr(10)&chr(10)&"商品已经放到您的储物柜中,请笑纳!"&chr(10)&"请到以下地址查看储物柜。"&chr(10)&"[URL=Visual.asp?shopid=100]查看储物柜[/URL]" rs("flag")=0 rs("issend")=1 rs.update rs.close set rs=nothing conn.execute("update [Ms_user] set userwealth=userwealth-"&(saleprice+SendFee)&" where username='"&membername&"'") conn.execute("update [Ms_user] set userwealth=userwealth+"&saleprice&" where username='"&checkstr(trim(request("fromuser")))&"'") set rs=server.createobject("adodb.recordset") sql="select * from [Ms_message]" rs.open sql,conn,1,3 rs.addnew rs("sender")=webname rs("incept")=trim(request("fromuser")) rs("title")="您出售的商品有人购买了!" rs("content")="您在二手市场出售的商品《[color=blue]"&itemName&"[/color]》已经被"&membername&"购买了!" rs("flag")=0 rs("issend")=1 rs.update rs.close set rs=nothing SendMsg="<li>已经成功地给 <font color=blue>"&username&"</font> 赠送了二手商品《<font color=blue>"&itemName&"</font>》!" response.write "<script>" response.write "window.opener.document.execCommand('Refresh');" response.write "</script>" call Send_Msg() else CartBag="" if CurItem>0 then for i=0 to itemcount-1 if CartBag<>"" then CartBag=CartBag&"|" SendSplit=split(itemsplit(i),"$") if ubound(SendSplit)=2 then if SendSplit(0)=CurItem and lcase(trim(SendSplit(1)))=lcase(trim(UserName)) then SendSplit(2)=MsgBody SucFlag=true end if CartBag=CartBag&SendSplit(0)&"$"&SendSplit(1)&"$"&SendSplit(2) else CartBag=CartBag&ItemSplit(i) end if next end if if SucFlag then response.cookies("mybuy_"&userid)=CartBag SendMsg="<li>已经修改了给 <font color=blue>"&username&"</font> 的随同赠言!" else if itemcount<CartLength then if CartBag<>"" then CartBag=CartBag&"|" CartBag=CartBag&CurItem&"$"&username&"$"&msgbody response.cookies("mybuy_"&userid)=CartBag SendMsg="<li>已将赠送给 <font color=blue>"&username&"</font> 的这个商品放到您的购物袋中!" else founderr=true SendMsg="<li>您的购物袋已满,无法将赠送给 <font color=blue>"&username&"</font> 的这个商品放入!" end if end if call Send_Msg() end if end if else call head_var("","")%> <table cellpadding=3 cellspacing=1 align=center class=tableborder1> <form action="?" method=post name=messager> <input type=hidden name="action" value="send"> <tr> <th colspan=3>赠送形象商品 -- 随同赠言(请输入完整信息)</th> </tr> <tr> <td class=tablebody1 valign=middle><b>受赠人:</b></td> <td class=tablebody1 valign=middle colspan=2><%if username<>"" then%><input class=2 type=hidden name="username" value="<%=username%>"><b><%=username%></b><%else%><input class=2 type=text name="username" size=45> <SELECT onchange=document.messager.username.value=this.options[this.selectedIndex].value;document.messager.username.focus()><OPTION selected value="">选择</OPTION><% set rs=server.createobject("adodb.recordset") sql="select friend from Ms_Friend where username='"&membername&"' order by addtime desc" rs.open sql,conn,1,1 do while not rs.eof %><OPTION value="<%=rs(0)%>"><%=rs(0)%></OPTION><% rs.movenext loop rs.close set rs=nothing %></SELECT><%end if%></td> </tr> <tr> <td class=tablebody1 valign=top width=15%><b>内容:</b></td> <td class=tablebody1 valign=middle><textarea cols=50 rows=6 name="msgbody" title="Ctrl+Enter发送"><%=msgbody%></textarea></td> <td rowspan=3 class=tablebody1 valign=middle baseName=images/img_visual/003.gif width="84" height="84" border="0" itemgender="" itemno=<%=CurItem%> layerno="" localpic=<%=LocalPic%> ImagePath="<%=PicPath%>" style="behavior:url(inc/NF_show2.htc)"></td> </tr> <tr> <td class=tablebody1 colspan=3><b>说明</b>:<br>① 您可以使用<b>Ctrl+Enter</b>键快捷发送赠言<br>② 内容最多<b>200</b>个字符<br>③ 赠送该商品的手续费为:<%=SendFee%> 元<% if request("fromuser")<>"" then response.write "<br>④ 购买该商品的费用为:"&saleprice&" 元" end if %></font></td> </tr> <tr> <td class=tablebody2 valign=middle colspan=3 align=center><input type=hidden name=itemid value=<%=curitem%>><input type=hidden name=myself value=<%=request("myself")%>><%if request("fromuser")<>"" then%><input type=hidden name=fromuser value=<%=request("fromuser")%>><%end if%><input class=2 type=Submit value="保存" name=Submit> <input class=2 type="reset" name="Clear" value="清除"> <input class=2 type="button" name="close" value="关闭" onclick="window.close()"><%if SucFlag then%> <a href=z_visual_cartbag.asp>[返回购物袋]</a><%end if%></td> </tr></form> </table> <%end if end if end if sub send_msg()%> <table cellpadding=3 cellspacing=1 align=center width=97%> <tr align=center> <th width="100%">赠送形象商品信息</th> </tr> <tr> <td width="100%" class=tablebody1><b>操作结果:</b><br><% if founderr then response.write "<font>" response.write sendmsg response.write "</font>" else response.write sendmsg end if %></td> </tr> <tr align=center> <td width="100%" class=tablebody2><a href="javascript:window.close()">[关闭窗口]</a> <% if SucFlag then %><a href="Visual_cartbag.asp">[返回购物袋]</a><% end if %></td> </tr> </table> <%end sub%>